package com.xishu.util;

import com.xishu.task.CustomerSystemTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Arrays;
import java.util.List;

public class TaskUtil {
    private static Logger logger = LoggerFactory.getLogger(CustomerSystemTask.class);


    /**
     * 当前时间是否是任务的执行时间，默认为1点到5点
     *
     * @return
     */
    public static boolean isTaskExecuteTime() {
        List<Integer> timeList = Arrays.asList(1, 2, 3, 4, 5);
        String formatHourDate = DateUtil.formatHourDate(System.currentTimeMillis());
        int hour = Integer.parseInt(formatHourDate);
        return timeList.contains(hour);
    }

    public static boolean vipUserTaskExecuteTime() {
        List<Integer> timeList = Arrays.asList(0, 1, 2, 3, 4, 5);
        String formatHourDate = DateUtil.formatHourDate(System.currentTimeMillis());
        int hour = Integer.parseInt(formatHourDate);
        return timeList.contains(hour);
    }

    /**
     * 是否是配额的执行时间
     *
     * @return
     */
    public static boolean isQuotaExecuteTime() {
        String hour = DateUtil.formatHourDate(System.currentTimeMillis());
        int hourInt = Integer.parseInt(hour);

        return 12 == hourInt;
    }
}
